import { Computer } from "./Computer";
import { Hub } from "./Hub";

const commonHub = Hub.initHub();
const commonHub2 = Hub.initHub();
const computer1 = new Computer("aa-aa-aa-aa-aa-aa");
const computer2 = new Computer("bb-bb-bb-bb-bb-bb");
const computer3 = new Computer("cc-cc-cc-cc-cc-cc");
const computer4 = new Computer("dd-dd-dd-dd-dd-dd");
const computer5 = new Computer("ee-ee-ee-ee-ee-ee");
const computer6 = new Computer("ff-ff-ff-ff-ff-ff"); 

// 电脑1接入hub
commonHub.link(computer1);
computer1.linkHub(commonHub);

// 电脑2接入hub
commonHub.link(computer2);
computer2.linkHub(commonHub);

// 电脑3接入hub
commonHub.link(computer3);
computer3.linkHub(commonHub);


// 电脑4接入hub
commonHub2.link(computer4);
computer4.linkHub(commonHub2);

// 电脑5接入hub
commonHub2.link(computer5);
computer5.linkHub(commonHub2);

// 电脑6接入hub
commonHub2.link(computer6);
computer6.linkHub(commonHub2);

commonHub2.link(commonHub);
commonHub.link(commonHub2);



computer1.sendMessage("Hello World!", computer2);
computer2.sendMessage("Hello World!");
computer3.sendMessage("Hello World!");
computer3.sendMessage("Hello World!", computer5);
computer2.sendMessage("Hello World!", computer6);
